Skip to content

fix(abilities): flatten category slugs for WP 7.0 compatibility#223

Merged
chubes4 merged 1 commit intomainfrom
fix-ability-category-slugs
May 2, 2026
Merged

fix(abilities): flatten category slugs for WP 7.0 compatibility#223
chubes4 merged 1 commit intomainfrom
fix-ability-category-slugs

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented May 1, 2026

Summary

WordPress 7.0 RC2 tightened the Abilities API category slug validation regex to /^[a-z0-9]+(?:-[a-z0-9]+)*$/, rejecting any slug containing a forward slash. The datamachine-events/events, datamachine-events/venues, etc. category slugs that worked silently on 6.9 now fail registration on 7.0+, and every ability assigned to those categories logs category is not registered notices on every init.

On a busy production site (extrachill.com network), this generates ~13,000 notices per few minutes and was filling debug.log to multi-GB scale within hours of the WP 7.0 upgrade.

Fix

Flatten the four category slugs to match Data Machine core's pattern of <plugin>-<category> (e.g. datamachine-content, datamachine-media):

datamachine-events/events   →  datamachine-events-events
datamachine-events/venues   →  datamachine-events-venues
datamachine-events/testing  →  datamachine-events-testing
datamachine-events/settings →  datamachine-events-settings

Scope

  • 22 PHP files touched (1 constants file + 21 ability files)
  • 35 string-literal replacements
  • All ability names (e.g. data-machine-events/get-venue-events) keep their namespace/name slash format — that is still valid and required by the Abilities API name regex.
  • Abilities are not persisted in the database, so this is a purely code-side fix. No data migration needed.
  • Tests and docs do not reference the old category slugs (only ability names + block names, neither affected).

Verification

# Before fix:
$ tail -1000 wp-content/debug.log | grep -c "Ability category"
~900

# After deploy:
$ tail -1000 wp-content/debug.log | grep -c "Ability category"
0

Refs: data-machine-events#216

WordPress 7.0 RC2 tightened the Abilities API category slug validation regex
to /^[a-z0-9]+(?:-[a-z0-9]+)*$/, rejecting any slug containing a forward slash.
The 'datamachine-events/events', 'datamachine-events/venues', etc. category
slugs that worked silently on 6.9 now fail registration on 7.0+, and every
ability assigned to those categories logs "category is not registered" notices
on every init (~13,000 lines per few minutes on a busy site).

Flatten the four category slugs to match Data Machine core's pattern of
'<plugin>-<category>' (e.g. 'datamachine-content', 'datamachine-media'):

  datamachine-events/events   -> datamachine-events-events
  datamachine-events/venues   -> datamachine-events-venues
  datamachine-events/testing  -> datamachine-events-testing
  datamachine-events/settings -> datamachine-events-settings

Ability *names* (e.g. 'data-machine-events/get-venue-events') continue to use
the slash-separated namespace/name format — that is still valid and required
by the Abilities API registration regex.

Refs: data-machine-events#216
@homeboy-ci
Copy link
Copy Markdown
Contributor

homeboy-ci Bot commented May 1, 2026

Homeboy Results — data-machine-events

Audit

⚠️ Homeboy core PR-comment rendering currently supports the default audit,lint,test review report only. Check the action logs for audit.

Tooling versions
  • Homeboy CLI: homeboy 0.138.0+8f3599c
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: f9ab7a1
  • Action: Extra-Chill/homeboy-action@v2

@chubes4 chubes4 merged commit ee995c9 into main May 2, 2026
1 check passed
@chubes4 chubes4 deleted the fix-ability-category-slugs branch May 2, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant